package cn.jzq.kotoba.modules.sharding.controller;

import cn.jzq.kotoba.common.util.R;
import cn.jzq.kotoba.modules.sharding.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jzq
 * @date 2019/2/19 17:07
 */
@RestController
@RequestMapping("/person")
public class PersonController {

//    private final PersonMapper personMapper;
    private final PersonService personService;

    @Autowired
    public PersonController(PersonService personService) {
        this.personService = personService;
    }
//    @Autowired
//    private  PersonMapper personMapper;


    @GetMapping("/{id}")
    public R getPerson(@PathVariable("id") Integer id){
        return R.ok(personService.getPerson(id));
//        return R.ok(personMapper.getPerson(id));
    }
}
